package com.lyn.view.trackingBox;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;

/**
 * created by lyn at 2021/10/25
 */
public class TrackingBoxView extends View {
    private Rect rect;
    private Paint paint;

    public void setRectF(Rect rect) {
        this.rect = rect;
    }

    public TrackingBoxView(Context context) {
        super(context);
        init();
    }

    public TrackingBoxView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    private void init(){
        paint=new Paint();
        paint.setStrokeWidth(3);
        paint.setColor(Color.YELLOW);
        paint.setStyle(Paint.Style.STROKE);

    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        if (rect==null)return;
        canvas.drawRect(rect,paint);
    }
}
